<template>
  <div>
    <el-table
    :data="obj"
    stripe
    style="width: 100%">
    <el-table-column 
      prop="id"
      label="编号"
      width="150"
      align="center">
    </el-table-column>
    <el-table-column
      prop="money"
      label="金额"
      width="150"
      align="center">
    </el-table-column>
    <el-table-column
      prop="type"
      label="类型"
      width="170"
      align="center">
    </el-table-column>
    <el-table-column
      prop="description"
      label="描述"
      width="170"
      align="center">
    </el-table-column>
    <el-table-column
      prop="userId"
      label="员工ID"
      align="center">
    </el-table-column>
    <el-table-column
      prop="registerTime"
      label="凭证"
      align="center">
      <el-avatar :size="25" src="https://empty" @error="errorHandler">
        <img src="https://cube.elemecdn.com/e/fd/0fc7d20532fdaf769a25683617711png.png"/>
      </el-avatar>
    </el-table-column>
    <el-table-column
      label="操作"
      align="center">
      <template>
        <el-button type="text" size="small">已审核</el-button>
      </template>
    </el-table-column>
  </el-table>


  <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage1"
      :page-size="pageSize"
      layout="total, prev, pager, next"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
import qs from 'querystring';

export default {
  data(){
    return{
      obj:[],
      total:0,
      currentPage1:1,
      pageSize:6,
    }
  },
  methods:{
    //分页查询封装函数
      findAll(){
        var data={
          page:this.currentPage1-1,
          pageSize:this.pageSize
        }
        this.$axios.post("/waiter/queryShou",qs.stringify(data)).then(response=>{
        this.obj=response.data.data.list;
        this.total=response.data.data.total
        // console.log(response.data.data)
    })
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
        this.currentPage1=val;
        this.findAll();
      },
  },
  created(){
    this.findAll();
  }
}
</script>

